package com.huawei.appgallery.forum.posts.card;

import android.content.Context;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Environment;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.ViewStub.OnInflateListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.huawei.appgallery.forum.base.card.bean.Section;
import com.huawei.appgallery.forum.base.card.bean.VideoInfo;
import com.huawei.appgallery.forum.base.ui.buoy.action.VideoNetChangeDialogAction;
import com.huawei.appgallery.forum.cards.widget.PostTitleTextView;
import com.huawei.appgallery.forum.cards.widget.UserInfoTextView;
import com.huawei.appgallery.forum.posts.buoy.action.OpenPersonCenterAction;
import com.huawei.appgallery.forum.posts.buoy.action.OpenPostContentImageAction;
import com.huawei.appgallery.forum.user.api.IUserFollow;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.support.video.VideoPlayer;
import com.huawei.appmarket.support.video.VideoPlayer.d;
import com.huawei.appmarket.support.video.fullscreen.FullScreenVideoPlayProtocol;
import com.huawei.appmarket.support.video.fullscreen.FullScreenVideoPlayProtocol.Request;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import huawei.widget.HwButton;
import o.bqx;
import o.bsp;
import o.bsu;
import o.bsy;
import o.bzd.b;
import o.bzd.e;
import o.bzd.i;
import o.bzd.j;
import o.caj;
import o.cdb;
import o.cgz;
import o.cil;
import o.cim.a;
import o.cjm;
import o.cjo;
import o.dex;
import o.doo;
import o.eqx;
import o.evx;
import o.ezn;
import o.faj;
import o.fho;
import o.fjo;

public class BuoyForumPostDetailHeadCard extends ForumPostDetailHeadCard {
    private ImageView ʻॱ;
    private TextView ˎˎ;
    private RelativeLayout ᐝॱ;

    public BuoyForumPostDetailHeadCard(Context context) {
        super(context);
    }

    public cgz ˏ(View view) {
        ʽ(view);
        this.ˏ = (PostTitleTextView) view.findViewById(b.ͺˏ);
        this.ˊ = (ImageView) view.findViewById(b.ˎͺ);
        this.ˋ = (TextView) view.findViewById(b.ˏͺ);
        this.ᐝ = (TextView) view.findViewById(b.ˑॱ);
        this.ʻ = view.findViewById(b.ꓸ);
        this.ʼ = (TextView) view.findViewById(b.ꜟ);
        this.ˎ = (UserInfoTextView) view.findViewById(b.ͺˎ);
        this.ˎ.setFromBuoy(true);
        this.ʽ = (ViewGroup) view.findViewById(b.ʿॱ);
        this.ॱॱ = (TextView) view.findViewById(b.ˋʻ);
        this.ˊॱ = (TextView) view.findViewById(b.ٴ);
        this.ˎ.setFakeView(this.ˊॱ);
        this.ˎ.setUserFakeViewChangeListener(this);
        this.ॱˊ = (ViewStub) view.findViewById(b.ॱﹳ);
        if (this.ॱˊ != null) {
            this.ॱˊ.setOnInflateListener(new OnInflateListener(this) {
                final /* synthetic */ BuoyForumPostDetailHeadCard ˊ;

                {
                    this.ˊ = r1;
                }

                public void onInflate(ViewStub viewStub, View view) {
                    this.ˊ.ॱˎ = true;
                }
            });
        }
        this.ˎ.setShowHostStamp(false);
        this.ˎ.setShowModeratorStamp(true);
        this.ͺ = (HwButton) view.findViewById(b.ˊʼ);
        this.ͺ.setOnClickListener(new evx(this) {
            final /* synthetic */ BuoyForumPostDetailHeadCard ˎ;

            {
                this.ˎ = r1;
            }

            public void ˋ(View view) {
                this.ˎ.ॱॱ();
            }
        });
        if (bsp.ˋ()) {
            this.ͺ.setBackground(ˉ().getContext().getDrawable(e.ˋॱ));
        }
        this.ᐝॱ = (RelativeLayout) view.findViewById(b.ॱᶥ);
        this.ʻॱ = (ImageView) view.findViewById(b.ॱˌ);
        this.ˎˎ = (TextView) view.findViewById(b.ॱᐨ);
        this.ᐝॱ.setOnClickListener(new evx(this) {
            final /* synthetic */ BuoyForumPostDetailHeadCard ˊ;

            {
                this.ˊ = r1;
            }

            public void ˋ(View view) {
                dex o_caj = new caj(this.ˊ.ˉ().getContext());
                if (((faj) cdb.ॱ(faj.class)).ˏ() != null) {
                    cil.ˋ(this.ˊ.ʼॱ, new a().ˊ(this.ˊ.ॱ.ʽ().ॱॱ()).ˏ(String.valueOf(4)).ˋ());
                    Bundle bundle = new Bundle();
                    bundle.putString("SEGMENT_URI", this.ˊ.ॱ.ʽ().ॱॱ());
                    bundle.putString("DOMAIN_ID", this.ˊ.ॱ.ॱ());
                    ((faj) cdb.ॱ(faj.class)).ˏ(this.ˊ.ˉ().getContext(), o_caj, bundle);
                    return;
                }
                bqx.ॱ("BuoyForumPostDetailHeadCard", "buoyBridge == null");
            }
        });
        if (VERSION.SDK_INT >= 23) {
            this.ˎ.ˊ().setTextAppearance(i.ˏ);
            this.ˎ.ॱ().setTextAppearance(i.ˎ);
            this.ˎ.ˋ().setTextAppearance(i.ˋ);
        } else {
            this.ˎ.ˊ().setTextAppearance(this.ʼॱ, i.ˏ);
            this.ˎ.ॱ().setTextAppearance(this.ʼॱ, i.ˎ);
            this.ˎ.ˋ().setTextAppearance(this.ʼॱ, i.ˋ);
        }
        return this;
    }

    public void ˏ(CardBean cardBean) {
        super.ˏ(cardBean);
        if (this.ॱ != null && this.ॱ.ˊ() == 0) {
            ˋ(this.ॱ);
        }
    }

    protected void ˎ(ForumPostDetailHeadCardBean forumPostDetailHeadCardBean) {
        VideoInfo ʽ = forumPostDetailHeadCardBean.ᐝ().ʽ();
        if (forumPostDetailHeadCardBean.ᐝ().ᐝॱ() && ˋ(ʽ)) {
            if (!this.ॱˎ) {
                View inflate = this.ॱˊ.inflate();
                this.ॱˋ = (VideoPlayer) inflate.findViewById(b.י);
                this.ॱᐝ = inflate.findViewById(b.ـॱ);
                ॱ(this.ॱˋ);
            }
            ॱ(forumPostDetailHeadCardBean);
        }
    }

    protected void ॱ(VideoPlayer videoPlayer) {
        if (videoPlayer != null) {
            videoPlayer.setBuoyNetChangeCallBack(new d(this) {
                final /* synthetic */ BuoyForumPostDetailHeadCard ˋ;

                {
                    this.ˋ = r1;
                }

                public void ˏ(Context context) {
                    ((faj) cdb.ॱ(faj.class)).ˊ(context, TransferActivity.class, new Intent(VideoNetChangeDialogAction.ACTION));
                }

                public void ˋ(Context context) {
                    ˏ(context);
                }
            });
            videoPlayer.setBuoyFullScreenMethod(new VideoPlayer.e(this) {
                final /* synthetic */ BuoyForumPostDetailHeadCard ˊ;

                {
                    this.ˊ = r1;
                }

                public void ˋ(Context context, String str, int i) {
                    if (doo.ˊ(context)) {
                        cjo fullScreenVideoPlayProtocol = new FullScreenVideoPlayProtocol();
                        Request request = new Request();
                        request.ˎ(str);
                        request.ˊ(i);
                        fullScreenVideoPlayProtocol.ˊ(request);
                        cjm o_cjm = new cjm("fullscreenvideoplay.activity", fullScreenVideoPlayProtocol);
                        o_cjm.ॱ().setAction("");
                        ((faj) cdb.ॱ(faj.class)).ॱ(context, null, o_cjm);
                        return;
                    }
                    ezn.ˊ().ˊ(context.getString(j.ʿ));
                }
            });
        }
    }

    protected void ˎ(int i) {
        String str = Environment.getExternalStorageDirectory() + "/Pictures/" + this.ʼॱ.getString(j.ʻ);
        Intent intent = new Intent(this.ʼॱ, TransferActivity.class);
        intent.setAction(OpenPostContentImageAction.ACTION_OPEN_FORUM_POST_CONTENT_IMAGE);
        intent.putExtra(OpenPostContentImageAction.BUNDLE_SDCARD_DIR, str);
        intent.putExtra(OpenPostContentImageAction.BUNDLE_INDEX, i);
        intent.putExtra(OpenPostContentImageAction.BUNDLE_PIC_URI_LIST, this.ˏॱ);
        ((faj) cdb.ॱ(faj.class)).ˎ(this.ʼॱ, TransferActivity.class, intent, false);
    }

    protected void ˊ(ForumPostDetailHeadCardBean forumPostDetailHeadCardBean) {
        Intent intent = new Intent(this.ʼॱ, TransferActivity.class);
        intent.setAction(OpenPersonCenterAction.ACTION_OPEN_PERSON_CENTER);
        intent.putExtra("UserId", forumPostDetailHeadCardBean.ʼ().ॱ());
        intent.putExtra("Type", forumPostDetailHeadCardBean.ʼ().ˊ());
        intent.putExtra("DomainId", forumPostDetailHeadCardBean.ॱ());
        ((faj) cdb.ॱ(faj.class)).ˎ(this.ʼॱ, TransferActivity.class, intent, false);
    }

    protected fjo<IUserFollow.b> ॱ(int i) {
        return ((IUserFollow) fho.ˏ().ˋ("User").ॱ(IUserFollow.class)).ˊ(this.ʼॱ, this.ॱ.ʼ(), i, true);
    }

    private void ˋ(ForumPostDetailHeadCardBean forumPostDetailHeadCardBean) {
        this.ᐝॱ.setVisibility(0);
        Section ʽ = forumPostDetailHeadCardBean.ʽ();
        if (forumPostDetailHeadCardBean.ʽ() != null) {
            this.ˎˎ.setText(ʽ.ˏ());
            if (!TextUtils.isEmpty(ʽ.ॱ())) {
                eqx.ˏ(this.ʻॱ, ʽ.ॱ(), "app_default_icon");
            }
        }
    }

    public int ˎ() {
        return bsu.ˋ(this.ʼॱ);
    }

    protected int ʻ() {
        return (bsu.ॱ(this.ʼॱ) - (this.ʼॱ.getResources().getDimensionPixelOffset(bsy.e.ʿ) * 3)) - this.ʼॱ.getResources().getDimensionPixelOffset(bsy.e.ˎˎ);
    }

    protected void ˎ(TextView textView) {
        if (VERSION.SDK_INT >= 23) {
            textView.setTextAppearance(i.ˎ);
        } else {
            textView.setTextAppearance(this.ʼॱ, i.ˎ);
        }
    }

    protected void ˋ(int i) {
        if (i == 1) {
            this.ˋॱ = i;
            this.ͺ.setText(j.ʼ);
        } else if (i == 2) {
            this.ˋॱ = i;
            this.ͺ.setText(j.ʽ);
        } else {
            this.ˋॱ = i;
            this.ͺ.setText(j.ᐝ);
        }
    }
}
